import { find } from 'lodash';

export const getTableColumns = (
	{ params, orgList, locationTypeList, areaTypeList }: 
	{ params :any, orgList:any, locationTypeList: any, areaTypeList: any }
) => [
	{
		title: "路线ID",
		dataIndex: "id",
		width: 140,
		ellipsis: true
	},
	{
		title: "场景名称",
		dataIndex: "scName",
		width: 140,
		ellipsis: true
	},
	{
		title: "路线名称",
		dataIndex: "rtName",
		width: 140,
		ellipsis: true
	},
	{
		title: "备注",
		dataIndex: "remark",
		width: 140,
		ellipsis: true
	},
	{
		title: "创建日期",
		dataIndex: "createTime",
		width: 140,
		ellipsis: true
	},
];

export const USER_STATUS = [
	{ label: '在线', value: 1 },
	{ label: '离线', value: 2 }
]

export const getSearchColumns = ({sceneList, orgList}: any) => [
	{
		type: "input",
		placeholder: "路线名称",
		name: "rtName"
	},
	{
		type: "select",
		placeholder: "场景",
		name: "scId",
		options: sceneList?.data?.list || [],
		fieldProps:{
			fieldNames: {
				label: 'scName',  // 显示文本对应的字段
				value: 'id',    // 值对应的字段
			}
		}
	},
	{
		type: "select",
		placeholder: "所属组织",
		name: "createOrgId",
		options: orgList?.data || [],
		fieldProps:{
			fieldNames: {
				label: 'name',  // 显示文本对应的字段
				value: 'id',    // 值对应的字段
			}
		}
	}
]


export const getCreateColumns = ({sceneList}: any) => {
	return [
		{
			type: "select",
			placeholder: "场景名称",
			label: "场景名称",
			name: "scId",
			rules: [{ required: true, message: '这是必填项' }],
			options: sceneList?.data?.list || [],
			fieldProps:{
				fieldNames: {
					label: 'scName',  // 显示文本对应的字段
					value: 'id',    // 值对应的字段
				}
			}
		},
		{
			type: "input",
			placeholder: "路线名",
			label: "路线名",
			name: "rtName",
			rules: [
				{ required: true, message: '这是必填项' },
			]
		},
		{
			type: "input",
			placeholder: "描述",
			label: "描述",
			name: "remark",
			rules: [{ required: true, message: '这是必填项' }]
		},
	]
}
